import TileLayer from 'ol/layer/Tile'
import TileArcGISRest from 'ol/source/TileArcGISRest'
import OSM from 'ol/source/OSM'
import XYZ from 'ol/source/XYZ'

let maptype = 1         

var streetmap = function () {
    var maplayer = null
    switch (maptype) {
        case 0:
            maplayer = new TileLayer({
                source: new XYZ({
                    url: 'http://127.0.0.1:7080/streetmap/shenzhen/{z}/{x}/{y}.jpg'
                })
            })
        break
        case 1:
            maplayer = new TileLayer({
                source: new OSM()
            })
        break
        case 2:
            maplayer = new TileLayer({
                source: new TileArcGISRest({
                    url: 'https://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer'
                })
            })
        break
    }
    return [maplayer]
}

var mapconfig = {
    x: 114.064839,     
    y: 22.548857,
    zoom: 15,          
    streetmap: streetmap
}

export default mapconfig